<template>
	<view class="container">
		<view>
			<desc-wrapper :title="title" :desc="desc"></desc-wrapper>
			<z-card title="解梦信息">
				<block v-if="resp">
					<view class="enhance-text" style="margin-top: -30rpx;margin-bottom: 20rpx;">与{{keyname}}有关的梦</view>
					<view class="card-content-item" v-for="(item, k) in resp" :key="k">
						<view class="desc-text flex-row justify-between " style="width: 610rpx;">
							<navigator :url="`/pages/zhougong/detaildesc?index=${k}`" style="width: 100%; display: flex;justify-content: space-between;">
								<text class="shrink-0 biaoti" style="padding-left: 10rpx;padding-right: 10rpx;padding-top: 3rpx;padding-bottom: 3rpx;">{{ item.title }}</text>
								<text  style="color: gray;font-size: 13px;">结果分析</text>
							</navigator>
						</view>
					</view>
				</block>

			</z-card>
			<view class="bottom-btns" style="transform: translateY(-100%);" @click="todashi">
				<view class="start-btn">
					<text>大师详解</text>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '周公解梦结果分析',
				desc: '本次测算结果仅供娱乐使用，请勿用于封建迷信和违法用途。',
				resp: null,
			}
		},
		onLoad(opt) {
			const that = this
			let params = JSON.parse(opt.formData)
			this.keyname = params.title_zhougong
			uni.request({
				url: 'https://cs.appzdm.com:3000/Gongju/zhougong',
				method: 'POST',
				header: {
					'Content-Type': 'application/x-www-form-urlencoded'
				},
				data: params,
				success: (res) => {
					console.log(res.data.data, '###########');
					that.resp = res.data.data
					uni.setStorageSync('zgjm', res.data.data)
				},
				fail: (error) => {
					console.error('Request Failed:', error);
				}
			});
		},
		methods:{
			todashi(){
				uni.switchTab({
					url:'/pages/tabbar/service'
				})
			}
		}
	}
</script>
<style lang="scss">
.biaoti{
	background: #ffffff;
	box-shadow: 0rpx 5rpx 6rpx 2rpx rgba(39, 85, 21, 0.18);
	border-radius: 5rpx;
}
</style>